public class Data {
    public int year;//年
    public int month;//月
    public int day;//日
    public  Data() {
       /* this.year = 2008;
        this.month = 8;
        this.day = 8;*/
        this(2008,8,8);
        System.out.println("执行了不带参数的构造方法....");
    }/**/
    public Data(int year,int month,int day) {
        this.year = year;
        this.month = month;
        this.day = day;
        System.out.println("执行了带有三个参数的构造方法......");
    }



    //局部变量优先使用   谁调用当前这个方法 谁就是this
    public void setDate(int year,int month,int day) {
        this.year = year;
        this.month = month;
        this.day = day;
    }
    public void printDate() {
        System.out.println("年："+this.year+" 月："+this.month+" 日："+this.day);
        this.haha();
    }
    public  void haha() {
        System.out.println("hahah!");
    }

    public static void main(String[] args) {
        Data data = new Data();
        data.setDate(2003,11,5);
        data.printDate();
        Data data1 = new Data();
        data.setDate(2006,10,5);
        data.printDate();
    }
}

